from django.conf.urls.defaults import *
from simpleblog.dblog.models import Blog, Comment

blog_set = {
    'queryset': Blog.objects.all(),
}

urlpatterns = patterns('',
    (r'^simpleblog/$', 'django.views.generic.list_detail.object_list', blog_set),

    (r'^simpleblog/blog/(?P<object_id>\d+)/$',
          'django.views.generic.list_detail.object_detail', blog_set),
    
    (r'^simpleblog/blog/(?P<object_id>\d+)/comment/$', 
         'django.views.generic.list_detail.object_detail', 
         dict(blog_set, template_name='dblog/comment.html')),
    
    (r'^simpleblog/writeBlog/$', 'simpleblog.dblog.views.addEntry',
          {'template': 'dblog/blogEntry.html'}),
    
    (r'^simpleblog/blog/(?P<object_id>\d+)/comment/add/$', 
                             'simpleblog.dblog.views.addComment', 
                             dict(blog_set, template_name='dblog/addComment.html')),
                             
    (r'^simpleblog/blog/postEntry/$', 'simpleblog.dblog.views.postEntry'),
    (r'^simpleblog/blog/(?P<blog_id>\d+)/postComment/$', 
                             'simpleblog.dblog.views.postComment'),
    
    (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'dblog/login.html'}),
    (r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'template_name': 'dblog/logout.html'}),
    (r'^accounts/newUser/$', 'simpleblog.dblog.views.newUser'),
    (r'^accounts/profile/$', 'simpleblog.dblog.views.viewProfile'),

    (r'^admin/', include('django.contrib.admin.urls')),
    (r'^scripts/(?P<path>.*)$', 'django.views.static.serve', 
                                 {'document_root': './scripts'}),
)
